package com.zhijiaoyun.dao;

import com.zhijiaoyun.dao.core.IBaseDao;
import com.zhijiaoyun.model.User;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * @author shisfish
 * @date 2017/6/6
 */
public interface IUserDao extends IBaseDao<User> {

    /**
     * count by params
     *
     * @param username
     * @return
     */
    Integer countByParams(@Param("username") String username);

    Integer countByIdName(@Param("id") long id, @Param("name") String name);

    /**
     * page by params
     *
     * @param beginIndex
     * @param pageSize
     * @param username
     * @return
     */
    List<User> pageByParams(@Param("beginIndex") int beginIndex, @Param("pageSize") int pageSize,
                            @Param("username") String username);

    /**
     * select by name
     *
     * @param username
     * @return
     */
    User selectUserByUsername(String username);

    /**
     * get by username not this id
     *
     * @param userId
     * @param username
     * @return
     */
    User getUserByUsernameNotUserId(@Param("userId") long userId, @Param("username") String username);

    int selectByKV(@Param("typeName") String typeName, @Param("typeValue") String typeValue);

    /**
     * select by email
     *
     * @param email
     * @return
     */
    User selectByEmail(String email);

    /**
     * select by mobile
     *
     * @param mobile
     * @return
     */
    User selectByMobile(String mobile);

    /**
     * 获取全部数量
     *
     * @return
     */
    int countAll();

    /**
     * all
     * @return
     */
    List<User> listAll();
}
